﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using University.Workshop.Presenters.WaterPurchase;

namespace University.Workshop.Presentation.WaterPurchase
{
    /// <summary>
    /// Interaction logic for PageFirstStepModifyWaterPurchase.xaml
    /// </summary>
    public partial class PageFirstStepModifyWaterPurchase : Page, IFirstStepForModifyWaterPurchase
    {
        PresenterModifyWaterPurchaseView pInternal;
        PresenterFirstStepForModifyWaterPurchase pFirstStepForModifyWaterPurchase;

        public PageFirstStepModifyWaterPurchase(PresenterModifyWaterPurchaseView pExternal)
        {
            InitializeComponent();
            pInternal = pExternal;
            pFirstStepForModifyWaterPurchase = new PresenterFirstStepForModifyWaterPurchase(this);
        }

        /*
        private void CantCupyPasteOrCut(object sender, CanExecuteRoutedEventArgs e)
        {
            if (e.Command == ApplicationCommands.Copy)
                e.Handled = true;
            if (e.Command == ApplicationCommands.Cut)
                e.Handled = true;
            if (e.Command == ApplicationCommands.Paste)
                e.Handled = true;
        }

        private void LicencePlateTxt_PreviewLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
        {
            Boolean existeCisterna;

            existeCisterna = pFirstStepForRegisterWaterPurchase.VerifyIfCisternExist();
            if (existeCisterna)
            {
                LicencePlateTxt.IsReadOnly = true;
            }
        }

        private void LicencePlateTxt_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Space)
            {
                e.Handled = true;
            }
        }*/

        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            App.Current.MainWindow.Title = "Modificar Compra";
        }

        #region IFirstStepForModifyWaterPurchase Members

        public string LicencePlate
        {
            set
            {
                LicencePlateLbl.Content = value;
            }
        }

        public string Capacity
        {
            set
            {
                CapacityLbl.Content = value;
            }
        }

        public string PersonNames
        {
            set
            {
                PersonNamesLbl.Content = value;
            }
        }

        public string PersonLastNames
        {
            set
            {
                PersonLastNamesLbl.Content = value;
            }
        }

        #endregion


        #region IRegisterBasicView Members

        public Model.WaterPurchase WaterPurchaseToRegister
        {
            get;
            set;
        }

        public void Update()
        {
            pFirstStepForModifyWaterPurchase.UpdateData();
        }

        public string SystemMessage
        {
            get
            {
                throw new NotImplementedException();
            }
            set
            {
                MessageBox.Show(value);
            }
        }

        public string ErrorMessage
        {
            get
            {
                throw new NotImplementedException();
            }
            set
            {
                MessageBox.Show(value);
            }
        }

        public void ChargeDataToBasic()
        {
            pFirstStepForModifyWaterPurchase.ChargeDataWaterPurchase();
        }

        public void GoNextPage()
        {
            pInternal.GoStepTwo();
        }

        public void GoBackPage()
        {
        }

        #endregion

        #region IModifyBasicView Members

        public Model.WaterPurchase WaterPurchaseToModify
        {
            get;
            set;
        }

        #endregion
    }
}
